package com.retail.wxchat.controller;

import com.retail.core.common.AbstractCommonController;
import com.retail.core.entity.ParamReq;

import com.retail.core.entity.result.PageResult;
import com.retail.core.entity.result.Result;
import com.retail.global.security.LoginUserUtil;
import com.retail.global.annon.TraceLog;
import com.retail.wxchat.entity.request.RetailWxGetMoneyRequest;
import com.retail.wxchat.entity.vo.RetailWxGetMoneyVo;
import com.retail.wxchat.service.RetailWxGetMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
* 提现手续比例 API
* @author Administrator
*/
@Api(tags = "提现手续比例 API")
@RestController
@RequestMapping("/retailWxGetMoney")
public class RetailWxGetMoneyController extends AbstractCommonController<RetailWxGetMoneyService, RetailWxGetMoneyRequest, RetailWxGetMoneyVo> {

    private final RetailWxGetMoneyService retailWxGetMoneyService;

    public RetailWxGetMoneyController(RetailWxGetMoneyService retailWxGetMoneyService) {
        this.retailWxGetMoneyService = retailWxGetMoneyService;
    }

    @TraceLog()
    @GetMapping("{id}")
    public Result getModel(@PathVariable("id") Long id) {
        return super.getModel(retailWxGetMoneyService, id);
    }

    @TraceLog()
    @GetMapping("getUseRetailWxGetMoney")
    public Result getUseRetailWxGetMoney() {
        return retailWxGetMoneyService.getUseRetailWxGetMoney();
    }

    @TraceLog()
    @PostMapping
    @ApiOperation("保存提现手续比例")
    public Result<Integer> save(@RequestBody RetailWxGetMoneyRequest request) {
        request.setCreateUser(LoginUserUtil.getUserId());
        return super.save(retailWxGetMoneyService, request);
    }

    @TraceLog()
    @PutMapping
    @ApiOperation("更新提现手续比例")
    public Result<Integer> update(@RequestBody RetailWxGetMoneyRequest request) {
        request.setCreateUser(LoginUserUtil.getUserId());
        return super.update(retailWxGetMoneyService, request);
    }


    @TraceLog()
    @PostMapping("insertRetailWxGetMoneyContent")
    @ApiOperation("保存提现手续比例")
    public Result<Integer> insertRetailWxGetMoneyContent(@RequestBody RetailWxGetMoneyRequest request) {
        request.setCreateUser(LoginUserUtil.getUserId());
        return retailWxGetMoneyService.insertRetailWxGetMoneyContent(request);
    }

    @TraceLog()
    @PostMapping("listPage")
    @ApiOperation("提现手续比例-查询")
    public Result<List<RetailWxGetMoneyVo>>listPage(@RequestBody ParamReq<RetailWxGetMoneyRequest> req) {
        return super.listPage(retailWxGetMoneyService, req);
    }

    @TraceLog()
    @PostMapping("countPage")
    @ApiOperation("提现手续比例-统计")
    public Result<Integer> countPage(@RequestBody ParamReq<RetailWxGetMoneyRequest> req) {
        return super.countPage(retailWxGetMoneyService, req);
    }

    @TraceLog()
    @PostMapping("page")
    @ApiOperation("提现手续比例-分页数据")
    public Result<PageResult> page(@RequestBody ParamReq<RetailWxGetMoneyRequest> req) {
        return super.page(retailWxGetMoneyService, req);
    }

    @TraceLog()
    @DeleteMapping("/delete/{id}")
    @ApiOperation("删除提现手续比例")
    public Result<Integer> delete(@PathVariable("id") Long id) {
        return super.delete(retailWxGetMoneyService, id);
    }

    @TraceLog()
    @ApiOperation("批量删除提现手续比例")
    @DeleteMapping("{ids}")
    public Result<Integer> batchDelete(@PathVariable("ids") List<Long> ids) {
        return super.batchDelete(retailWxGetMoneyService, ids);
    }

    @Override
    public Long getLoginUserId() {
        return LoginUserUtil.getUserId();
    }

}
